Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've started digging through the codebase on wins with regards to performance, I've seen a lot of them.... However, some of them also come down to our ... weird usage of TypeScript.
Let's take the
Token
as an example, we did a great thing in creating it as a class as it enforced consistent monomorphic backing shapes, however we do a non-null assertion, for the reason thatvalue
can actually be undefined. When we useToken
we always assume thatvalue
is defined which makes all of this deopt as we will call functions withstring | undefined
the whole thing while our code is geared forstring
.I've attempted to make
value
the correct type which resulted in a lot more issues.In addition to that we have a lot of call-sites for the
.slice
method, we however do polymorphic access on it as adjacent call-sites will invokeString.slice
right next toArray.slice
which makes.slice
not optimizeable, instead we can resort to convertingString.slice
intoString.substring
to avoid this issue all together.The last noLocation parse bailout remaining is the
.slice
case ofblockstring.ts
The improvements on the parser benchmark are currently minimal, I am trying to discover the deopts and how we can have a way forward.